<?php
// site root
$sSiteRoot = '../src/webservice';
define("SITE_ROOT", realpath(dirname(__FILE__) . '/' . $sSiteRoot));


require_once SITE_ROOT . '/../lib/simaqian/libsimaqian.php';

/**
 * Fake
 */
class XapianQuery {
    const OP_AND = 1;
    const OP_OR = 2;

    public function __construct($mOPorTerm, $oQuery1 = null, $oQuery2 = null) {
        if($oQuery1 && $oQuery2) {
            $this->op = $mOPorTerm;
            $this->query1 = $oQuery1;
            $this->query2 = $oQuery2;
        } else {
            $this->term = $mOPorTerm;
        }
    }

    protected $term;
    protected $op;
    protected $query1;
    protected $query2;
}


$oQueryParser = new QueryParser();
$oXapianQuery = $oQueryParser->parse("你好");
var_dump($oXapianQuery);
$oXapianQuery = $oQueryParser->parse("你好||中国");
var_dump($oXapianQuery);
$oXapianQuery = $oQueryParser->parse("你好||中国&&人");
var_dump($oXapianQuery);
$oXapianQuery = $oQueryParser->parse("我是中国人||(中国&&人)");
var_dump($oXapianQuery);
?>